package apof.services
{
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLVariables;
	
	public class TransactionCommiter
	{
		
		private var username:String;
		private var psw:String;
		private var url:String="http://api.fanfou.com/statuses/update.xml";
		public function TransactionCommiter(username:String,psw:String) {
			this.username=username;
			this.psw=psw;
		}
		
		public function commit(msg:String):void {
			var urlRequest:URLRequest=new URLRequest(url);
			var urlLoader:URLLoader=new URLLoader();
		
			urlRequest.setLoginCredentials(username,psw);
			urlRequest.method="POST";
				var urlVariables:URLVariables=new URLVariables();
				urlVariables["status"]=msg;
			urlRequest.data=urlVariables;
			urlLoader.load(urlRequest);
		}
		
	}
}